//
//  STOrderCell.m
//  store
//
//  Created by zhouzhouzhou on 2018/9/27.
//  Copyright © 2018年 zhou. All rights reserved.
//

#import "STOrderCell.h"

@implementation STOrderCell

-(void)awakeFromNib{
    [super awakeFromNib];
    _detailBtn.layer.borderColor = [UIColor redColor].CGColor;
    _detailBtn.layer.borderWidth = 1.0;
    _detailBtn.layer.cornerRadius = 3.0;
    [Tools setLayerCutCircularWithView:_headImg cornerRedii:20.0];
}
- (id)init {
    return [[[NSBundle mainBundle] loadNibNamed:@"STOrderCell" owner:nil options:nil] lastObject];
}

-(void)setOrderModel:(id)modelData type:(NSInteger)type{
    YLHomeOrderListModel * listModel = modelData;
    [_headImg sd_setImageWithURL:[NSURL URLWithString:listModel.userPath]];
    _nameLab.text = listModel.userNickname;
    _sexImg.image = [listModel.userGender intValue] == 1 ? IMAGENAMED(@"man_selected") : IMAGENAMED(@"girl_selected");
    if (type == 1) {
        _notesLab.hidden = NO;
        _notesLab.textColor = [UIColor greenColor];
    }else if (type == 4) {
        _notesLab.hidden = NO;
        _notesLab.textColor = [UIColor redColor];
    }else{
        _notesLab.hidden = YES;
    }
    _notesLab.text = listModel.describe;
    _serviceLab.text = listModel.servicename;
    _hairderName.text = listModel.stylistname;
    _timerLab.text = [NSString timechange:listModel.serviceTime];
    _priceLab.text = listModel.orderAmount;
    _orderNumLab.text = listModel.orderno;
    _distanceDay.text = [NSString stringWithFormat:@"%@",listModel.datename];
    
    if ([listModel.status integerValue] == 11) {
        [_detailBtn setTitle:@"邀请评价" forState:UIControlStateNormal];
        _detailBtn.layer.borderColor = LightGrayTextColor.CGColor;
        [_detailBtn setTitleColor:LightGrayTextColor forState:UIControlStateNormal];
    }else if ([listModel.status integerValue] == 18) {
        [_detailBtn setTitle:@"完成评价" forState:UIControlStateNormal];
        _detailBtn.layer.borderColor = LightGrayTextColor.CGColor;
        [_detailBtn setTitleColor:LightGrayTextColor forState:UIControlStateNormal];
    }else{
        [_detailBtn setTitle:@"查看详情" forState:UIControlStateNormal];
        _detailBtn.layer.borderColor = [UIColor redColor].CGColor;
        [_detailBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    }
    
}

@end
